package com.itheima.publisher;

import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @Classname SpringAmqpTest2
 * @Date 2024/12/24 15:47
 * @Created by 鲍宪立
 */
//@RequiredArgsConstructor
@SpringBootTest
public class SpringAmqpTest2 {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Test
    public void testSimpleQueue() {
        //队列名称
        String queueName = "simple.queue";
        //消息
        String message = "hello, spring amqp!";
        //发送消息
        rabbitTemplate.convertAndSend(queueName, "hello, spring amqp!");
    }

}
